package com.example.e_fileReader;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class DmoFilRader {
    public static void main(String[] args) {
        FileReader fr = null;
        try {
            fr = new FileReader("a.txt");
//            int data = fr.read();
//            System.out.println(data);
//            System.out.println("data====" + (char)data);
//            fr.close();

//            int len;
//            while ((len=fr.read()) != -1) {
//                System.out.println((char)len);
//            }

            char[] chars = new char[1024];
            int len;
            while ((len=fr.read(chars)) != -1) {
                System.out.println(new String(chars, 0, len));
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
